import 'package:local_coffee/components/hex.dart';
import 'package:local_coffee/components/rgba.dart';
import 'package:flutter/material.dart';
import 'package:local_coffee/components/c_appbar/custom_appbar.dart';
import 'package:local_coffee/components/icon.dart';
import 'package:local_coffee/routes/index.dart';
import 'package:local_coffee/utils/global.dart';

class ExampleWidgetsList extends StatelessWidget {

  final Object args;

  const ExampleWidgetsList({
    Key key, 
    this.args
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: HEX.hexfff,
      appBar: customAppBar(
        title: '组件列表',
        context: context,
      ),
      body: SingleChildScrollView(
        child: Container(
          padding: EdgeInsets.symmetric(horizontal: 15),
          child: Column(
            children: <Widget>[
              returnRow(
                context,
                child: Row(
                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
                  children: <Widget>[
                    Text('AButton'),
                    icon0xe60f(color: RGBA.rgbae4e4e4, size: 14)
                  ],
                ),
                onPress: () => G.pushNamed(N.exampleButton),
              ),
              returnRow(
                context,
                child: Row(
                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
                  children: <Widget>[
                    Text('AStepper 步进器'),
                    icon0xe60f(color: RGBA.rgbae4e4e4, size: 14)
                  ],
                ),
                onPress: () => G.pushNamed(N.exampleStepper),
              ),
              returnRow(
                context,
                child: Row(
                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
                  children: <Widget>[
                    Text('ADialog 弹出框'),
                    icon0xe60f(color: RGBA.rgbae4e4e4, size: 14)
                  ],
                ),
                onPress: () => G.pushNamed(N.exampleDialog),
              ),
              returnRow(
                context,
                child: Row(
                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
                  children: <Widget>[
                    Text('ARow 行'),
                    icon0xe60f(color: RGBA.rgbae4e4e4, size: 14)
                  ],
                ),
                onPress: () => G.pushNamed(N.exampleRow),
              ),
              returnRow(
                context,
                child: Row(
                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
                  children: <Widget>[
                    Text('ACheckBox 复选框'),
                    icon0xe60f(color: RGBA.rgbae4e4e4, size: 14)
                  ],
                ),
                onPress: () => G.pushNamed(N.exampleCheckBox),
              ),
              returnRow(
                context,
                child: Row(
                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
                  children: <Widget>[
                    Text('pulltorefresh 下拉刷新'),
                    icon0xe60f(color: RGBA.rgbae4e4e4, size: 14)
                  ],
                ),
                onPress: () => G.pushNamed(N.examplePullToRefresh),
              ),
            ],
          ),
        ),
      ),
    );
  }

  InkWell returnRow(BuildContext context, {Widget child, Function onPress}) {
    return InkWell(
      child: Container(
        padding: EdgeInsets.symmetric(vertical: 15),
        decoration: BoxDecoration(
          border: G.borderBottom(),
        ),
        child: child,
      ),
      onTap: () => onPress == null ? () {} : onPress(),
    );
  }
}
